package leetcode.code0223;

public class Solution1bak extends Solution223 {

	@Override
	public int computeArea(int ax1, int ay1, int ax2, int ay2, int bx1, int by1, int bx2, int by2) {
		int bx3 = bx1;
		int by3 = by2;
		int bx4 = bx2;
		int by4 = by1;
		int b1 = this.isBinA(ax1, ay1, ax2, ay2, bx1, by1);
		int b2 = this.isBinA(ax1, ay1, ax2, ay2, bx2, by2);
		int b3 = this.isBinA(ax1, ay1, ax2, ay2, bx3, by3);
		int b4 = this.isBinA(ax1, ay1, ax2, ay2, bx4, by4);
		System.out.println(b1);
		System.out.println(b2);
		System.out.println(b3);
		System.out.println(b4);
		int ax3 = ax1;
		int ay3 = ay2;
		int ax4 = ax2;
		int ay4 = ay1;
		int a1 = this.isBinA(bx1, by1, bx2, by2, ax1, ay1);
		int a2 = this.isBinA(bx1, by1, bx2, by2, ax2, ay2);
		int a3 = this.isBinA(bx1, by1, bx2, by2, ax3, ay3);
		int a4 = this.isBinA(bx1, by1, bx2, by2, ax4, ay4);
		System.out.println(a1);
		System.out.println(a2);
		System.out.println(a3);
		System.out.println(a4);

		int areaA = (ax2 - ax1) * (ay2 - ay1);
		int areaB = (bx2 - bx1) * (by2 - by1);
		int areaAB = areaA + areaB;
		return areaAB;
	}

	private int isBinA(int ax1, int ay1, int ax2, int ay2, int bx1, int by1) {
		if (bx1 > ax1 && bx1 < ax2 && by1 > ay1 && by1 < ay2) {
			return 1;//里面
		}
		if ((bx1 == ax1 && by1 == ay1) || (bx1 == ax2  && by1 == ay2)) {
			return 0;//上面
		}
		return -1;//外面
	}

	public static void main(String[] args) {
		Solution1bak so = new Solution1bak();
		so.debug1();
		so.debug2();

	}

}
